<template>
     <div class="mui-content mui-scroll-wrapper" >
         <div class="mui-scroll">
            <div class="oftenQuestion">
                <div class="cross-item" @tap="goToAboutApp()">
                    <span class="name">关于APP</span><span class="icon-you-01" style="font-size:1.1rem;float:right;line-height:50px;color:#aaaaaa;"></span>
                </div>
                <div class="cross-item"  @tap="goToAboutUpai()">
                    <span class="name">关于车城</span><span class="icon-you-01" style="font-size:1.1rem;float:right;line-height:50px;color:#aaaaaa;"></span>
                </div>
                <div class="cross-item"  @tap="goToCrowdorder()">
                    <span class="name">关于拼单模式</span><span class="icon-you-01" style="font-size:1.1rem;float:right;line-height:50px;color:#aaaaaa;"></span>
                </div>
                <div class="cross-item"  @tap="goToLoanClient()">
                    <span class="name">贷款客户</span><span class="icon-you-01" style="font-size:1.1rem;float:right;line-height:50px;color:#aaaaaa;"></span>
                </div>
                <div class="cross-item" style="border:none;"  @tap="goToBigBangClient()">
                    <span class="name">全款客户</span><span class="icon-you-01" style="font-size:1.1rem;float:right;line-height:50px;color:#aaaaaa;"></span>
                </div>
            </div>
            <div class="service" style="text-align:center;color:#666666;font-size:14px;margin-top:13px;" @tap="goChat">
                有疑问? <span style="color:#FF6A27;">请联系在线客服>></span>
            </div>
        </div>
    </div>
</template>

<script>
    import mui from 'static/js/mui'
    import {addServiceToCustomer} from '@/api/user'
    import storage from '@/utils/localstorage' 
    import CrossItem from '@/components/base/cross-item/cross-item'
    export default {
        components: {
            CrossItem
        },
        data() {return {}},
        methods:{
            goChat(){
                let that = this
                let type = storage.getLocalstorage('user').serviceId
                if(type){
                    this.$router.push({
                        name: "chat",
                        params: {
                        roomType: type
                        }
                    })
                }else{
                    if(type == null){
                    type = (Math.random() + 1).toFixed(0)
                    }
                    let mobile = storage.getLocalstorage('user').mobile
                    if(!mobile){
                        mui.alert('用户未注册', "消息提示", ['确定'],function() {
                            that.$router.push('/login')
                        },'div'); 
                  
                    }else{
                    let data = {serviceId: type, mobile: mobile}
                    addServiceToCustomer(data).then(res=>{
                        storage.setLocalstorage('user', res.data)
                    })
                    this.$router.push({
                        name: "chat",
                        params: {
                            roomType: type,
                        }
                    })
                    }
                }
            },
            goToAboutApp(){
                this.$router.push({
                    path:'/aboutApp'
                })
            },
            goToAboutUpai(){
                this.$router.push({
                    path:'/aboutUpai'
                })
            },
            goToCrowdorder(){
                this.$router.push({
                    path:'/ccrowdOrder'
                })
            },
            goToLoanClient(){
                this.$router.push({
                    path:'/loanClient'
                })
            },
            goToBigBangClient(){
                this.$router.push({
                    path:'/bigBangClient'
                })
            },
        },
        mounted(){
            mui.init({
                keyEventBind: {
                backbutton: true  //关闭back按键监听
                }
            })
            //竖向滚动
            scroll =mui('.mui-scroll-wrapper').scroll({
                scrollY: true, //是否竖向滚动
                scrollX: false, //是否横向滚动
                startX: 0, //初始化时滚动至x
                startY: 0, //初始化时滚动至y
                indicators: true, //是否显示滚动条
                deceleration: 0.0006, //阻尼系数,系数越小滑动越灵敏
                bounce:true //是否启用回弹
            });
            mui.back = function () {
                history.go(-1)
            }
        }
    }
</script>

<style lang="scss" scoped>
    .oftenQuestion{
        background:#fff;font-size:14px;
    }
    .cross-item {
    overflow:hidden;
    color: #333;
    height:50px;
    line-height:50px;
    background: #fff;
    border-bottom: 1px solid #F8F8F8;
    /* margin: 0 10px 0 10px;  */
    padding: 0 12px;
    .ico {
        display: inline-block;
        width: 30px;
        i {
        font-size: 20px;
        color: #fe970f;
        }
    }
    .name {
        font-size:0.7rem;
    }
    }
    .mui-bar-nav ~ .mui-content {
        padding-top:0px;
    }
 
</style>